package com.youoor.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.youoor.common.base.BaseDao;
import com.youoor.common.base.BaseServiceImpl;
import com.youoor.dao.CardMsgDao;
import com.youoor.domain.CardMsg;
import com.youoor.domain.CardMsgQuery;
import com.youoor.domain.CardMsgQuery.Criteria;
import com.youoor.service.CardMsgService;

@Service(value="cardMsgService")
public class CardMsgServiceImpl extends BaseServiceImpl<CardMsg,CardMsgQuery,Long> implements CardMsgService {

	private static final Logger logger = LoggerFactory.getLogger(CardMsgServiceImpl.class);
	
	@Resource(name = "cardMsgDao")
	private CardMsgDao cardMsgDao;
	
	@Override
	public BaseDao<CardMsg, CardMsgQuery, Long> getBaseDao() {
		// TODO Auto-generated method stub
		return cardMsgDao;
	}

	@Override
	public List<CardMsg> getCardMsgListByMainCardId(int mainCardId,int pageIndex,int limit) {
		
		CardMsgQuery query = new CardMsgQuery();
		Criteria criteria = query.createCriteria();
		query.setOrderByClause("ctime desc");
		criteria.andCardIdEqualTo(mainCardId);
		
		return  cardMsgDao.selectByExamplePage(query,pageIndex*limit, limit);
	}

	@Override
	public boolean isNoReadCardMsg(int userId) {
		// TODO Auto-generated method stub
		return false;
	}


}
